#pragma once

#include <string>
#include <fstream>
#include <map>
#include "as_def.hpp"

class Cas {
    std::string src;
    long index;
    std::map<std::string, long> label_msg;

    void compile_num();
    void compile_str();
    void compile_direct();
    void compile_var();
    void compile_addr();
    void compile_option();
    void compile_label();
    void compile_comment();

    void write_str(std::string str);
    void write_type(int type);
    bool is_whitespace();

public:
    std::ofstream output_file;

    void init(std::string input_filename, std::string output_filename);
    void compile();
    void write_filemsg();
};